package com.bocai.dahuatech.utils;

import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.bocai.dahuatech.R;
import com.bocai.dahuatech.ui.activity.LoginActivity;

/**
 * Created by admin on 2016/3/3.
 */
public class LoginDialogUtil {

    public static void loginDialog(final Context context){
        View dialogView= LayoutInflater.from(context).inflate(R.layout.dialog_delete,null);
        final AlertDialog dialog = new AlertDialog.Builder(context)
                .setView(dialogView).show();
        TextView tiitle=(TextView)dialog.findViewById(R.id.tv_dialog_title);
        TextView tvLogin=(TextView)dialog.findViewById(R.id.tv_dialog_delete);
        TextView dismiss=(TextView)dialog.findViewById(R.id.tv_dialog_dismiss);
        tvLogin.setText(R.string.tologin);
        dismiss.setText(R.string.know);
        tiitle.setText(R.string.nologin);
        tvLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                context.startActivity(new Intent(context, LoginActivity.class));
                dialog.cancel();
            }
        });
        dismiss.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.cancel();
            }
        });
    }

}
